.class public Lcom/opongo/blogapp/activities/PostsActivity;
.super Landroid/app/TabActivity;
.source "PostsActivity.java"


# static fields
#the value of this static final field might be set in the static constructor
.field public static final DEBUG:Z = false

.field public static final PREFS_NAME:Ljava/lang/String; = "BlogApp"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private editor:Landroid/content/SharedPreferences$Editor;

.field private last_post_id:I

.field private mTabHost:Landroid/widget/TabHost;

.field private post_id:I

.field private progressDialog:Landroid/app/ProgressDialog;

.field private receiver:Landroid/content/BroadcastReceiver;

.field private receiver2:Landroid/content/BroadcastReceiver;

.field private settings:Landroid/content/SharedPreferences;

.field private tab1:Landroid/content/Intent;

.field private userId:I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 40
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/PostsActivity;->DEBUG:Z

    .line 41
    const-class v0, Lcom/opongo/blogapp/activities/PostsActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/activities/PostsActivity;->TAG:Ljava/lang/String;

    .line 38
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 38
    invoke-direct {p0}, Landroid/app/TabActivity;-><init>()V

    return-void
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/activities/PostsActivity;)Landroid/app/ProgressDialog;
    .locals 1
    .parameter

    .prologue
    .line 135
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->getProgressDialog()Landroid/app/ProgressDialog;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/PostsActivity;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 44
    iput p1, p0, Lcom/opongo/blogapp/activities/PostsActivity;->userId:I

    return-void
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/PostsActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 44
    iget v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->userId:I

    return v0
.end method

.method static synthetic access$3()Ljava/lang/String;
    .locals 1

    .prologue
    .line 41
    sget-object v0, Lcom/opongo/blogapp/activities/PostsActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method private cleanupCache()V
    .locals 12

    .prologue
    const/16 v11, 0x14

    const/4 v9, 0x1

    const/4 v6, 0x0

    .line 258
    sget-boolean v7, Lcom/opongo/blogapp/activities/PostsActivity;->DEBUG:Z

    if-eqz v7, :cond_0

    sget-object v7, Lcom/opongo/blogapp/activities/PostsActivity;->TAG:Ljava/lang/String;

    const-string v8, "About to cleanup cache..."

    invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 260
    :cond_0
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-direct {v0, p0}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;)V

    .line 261
    .local v0, dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;
    new-instance v1, Lcom/opongo/blogapp/utils/FileCache;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/utils/FileCache;-><init>(Landroid/content/Context;)V

    .line 262
    .local v1, imgCache:Lcom/opongo/blogapp/utils/FileCache;
    new-array v4, v9, [Ljava/lang/String;

    const-string v7, "recent_posts"

    aput-object v7, v4, v6

    .line 264
    .local v4, tablesOrderByDate:[Ljava/lang/String;
    const/4 v7, 0x2

    new-array v5, v7, [Ljava/lang/String;

    const-string v7, "mostread_posts"

    aput-object v7, v5, v6

    .line 265
    const-string v7, "mostcommented_posts"

    aput-object v7, v5, v9

    .line 269
    .local v5, tablesOrderByOrder:[Ljava/lang/String;
    array-length v8, v4

    move v7, v6

    :goto_0
    if-lt v7, v8, :cond_1

    .line 281
    array-length v7, v5

    :goto_1
    if-lt v6, v7, :cond_2

    .line 291
    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 294
    const/4 v6, 0x3

    invoke-virtual {v1, v6}, Lcom/opongo/blogapp/utils/FileCache;->clear(I)I

    .line 295
    return-void

    .line 269
    :cond_1
    aget-object v3, v4, v7

    .line 270
    .local v3, table:Ljava/lang/String;
    new-instance v9, Ljava/lang/StringBuilder;

    const-string v10, "DELETE FROM "

    invoke-direct {v9, v10}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v9, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " WHERE "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    .line 271
    const-string v10, "_id"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " NOT IN (SELECT "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    .line 272
    const-string v10, "_id"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " FROM "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " ORDER BY "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    .line 273
    const-string v10, "date"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " DESC LIMIT "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    .line 274
    invoke-virtual {v9, v11}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, ");"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    .line 270
    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 276
    .local v2, query:Ljava/lang/String;
    invoke-virtual {v0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 269
    add-int/lit8 v7, v7, 0x1

    goto :goto_0

    .line 281
    .end local v2           #query:Ljava/lang/String;
    .end local v3           #table:Ljava/lang/String;
    :cond_2
    aget-object v3, v5, v6

    .line 282
    .restart local v3       #table:Ljava/lang/String;
    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "DELETE FROM "

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v8, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " WHERE "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 283
    const-string v9, "_id"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " NOT IN (SELECT "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 284
    const-string v9, "_id"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " FROM "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " ORDER BY "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 285
    const-string v9, "post_order"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " DESC LIMIT "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 286
    invoke-virtual {v8, v11}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, ");"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 282
    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 288
    .restart local v2       #query:Ljava/lang/String;
    invoke-virtual {v0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 281
    add-int/lit8 v6, v6, 0x1

    goto/16 :goto_1
.end method

.method private static createTabView(Landroid/content/Context;Ljava/lang/String;)Landroid/view/View;
    .locals 5
    .parameter "context"
    .parameter "text"

    .prologue
    .line 170
    invoke-static {p0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v2

    const v3, 0x7f03001a

    const/4 v4, 0x0

    invoke-virtual {v2, v3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    .line 171
    .local v1, view:Landroid/view/View;
    const v2, 0x7f080059

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 172
    .local v0, tv:Landroid/widget/TextView;
    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 173
    return-object v1
.end method

.method private getProgressDialog()Landroid/app/ProgressDialog;
    .locals 2

    .prologue
    .line 136
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    if-nez v0, :cond_0

    .line 137
    new-instance v0, Landroid/app/ProgressDialog;

    invoke-direct {v0, p0}, Landroid/app/ProgressDialog;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    .line 138
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    const v1, 0x7f070017

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/PostsActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/ProgressDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 139
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/app/ProgressDialog;->setIndeterminate(Z)V

    .line 140
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/app/ProgressDialog;->setCancelable(Z)V

    .line 142
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    return-object v0
.end method

.method private openPostByBroadcast(I)V
    .locals 3
    .parameter "p"

    .prologue
    .line 183
    iget v1, p0, Lcom/opongo/blogapp/activities/PostsActivity;->last_post_id:I

    if-eq p1, v1, :cond_0

    .line 184
    iput p1, p0, Lcom/opongo/blogapp/activities/PostsActivity;->last_post_id:I

    .line 185
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.opongo.post_open_by_push"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 186
    .local v0, i:Landroid/content/Intent;
    const-string v1, "POST_ID"

    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 187
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostsActivity;->sendBroadcast(Landroid/content/Intent;)V

    .line 189
    .end local v0           #i:Landroid/content/Intent;
    :cond_0
    return-void
.end method

.method private setupTab(Landroid/view/View;Ljava/lang/String;Landroid/content/Intent;)V
    .locals 3
    .parameter "view"
    .parameter "tag"
    .parameter "intent"

    .prologue
    .line 162
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->mTabHost:Landroid/widget/TabHost;

    invoke-virtual {v2}, Landroid/widget/TabHost;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-static {v2, p2}, Lcom/opongo/blogapp/activities/PostsActivity;->createTabView(Landroid/content/Context;Ljava/lang/String;)Landroid/view/View;

    move-result-object v1

    .line 163
    .local v1, tabview:Landroid/view/View;
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->mTabHost:Landroid/widget/TabHost;

    invoke-virtual {v2, p2}, Landroid/widget/TabHost;->newTabSpec(Ljava/lang/String;)Landroid/widget/TabHost$TabSpec;

    move-result-object v2

    invoke-virtual {v2, v1}, Landroid/widget/TabHost$TabSpec;->setIndicator(Landroid/view/View;)Landroid/widget/TabHost$TabSpec;

    move-result-object v2

    .line 164
    invoke-virtual {v2, p3}, Landroid/widget/TabHost$TabSpec;->setContent(Landroid/content/Intent;)Landroid/widget/TabHost$TabSpec;

    move-result-object v0

    .line 165
    .local v0, setContent:Landroid/widget/TabHost$TabSpec;
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->mTabHost:Landroid/widget/TabHost;

    invoke-virtual {v2, v0}, Landroid/widget/TabHost;->addTab(Landroid/widget/TabHost$TabSpec;)V

    .line 166
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 6
    .parameter "savedInstanceState"

    .prologue
    .line 63
    invoke-super {p0, p1}, Landroid/app/TabActivity;->onCreate(Landroid/os/Bundle;)V

    .line 64
    const v2, 0x7f030019

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostsActivity;->setContentView(I)V

    .line 66
    const-string v2, "BlogApp"

    const/4 v3, 0x0

    invoke-virtual {p0, v2, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v2

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->settings:Landroid/content/SharedPreferences;

    .line 67
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->settings:Landroid/content/SharedPreferences;

    invoke-interface {v2}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->editor:Landroid/content/SharedPreferences$Editor;

    .line 69
    sget-boolean v2, Lcom/opongo/blogapp/activities/PostsActivity;->DEBUG:Z

    if-eqz v2, :cond_0

    .line 70
    sget-object v2, Lcom/opongo/blogapp/activities/PostsActivity;->TAG:Ljava/lang/String;

    const-string v3, "*** create ***"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 72
    :cond_0
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->cleanupCache()V

    .line 74
    sget v2, Landroid/os/Build$VERSION;->SDK_INT:I

    const/4 v3, 0x7

    if-le v2, v3, :cond_1

    .line 75
    const v2, 0x7f070005

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostsActivity;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-static {p0, v2}, Lcom/google/android/c2dm/C2DMessaging;->register(Landroid/content/Context;Ljava/lang/String;)V

    .line 77
    :cond_1
    const v2, 0x1020012

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/PostsActivity;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TabHost;

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->mTabHost:Landroid/widget/TabHost;

    .line 80
    const/4 v2, 0x1

    .line 81
    const/high16 v3, 0x40c0

    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    invoke-virtual {v4}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v4

    .line 80
    invoke-static {v2, v3, v4}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F

    move-result v2

    float-to-int v1, v2

    .line 83
    .local v1, p:I
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->mTabHost:Landroid/widget/TabHost;

    invoke-virtual {v2}, Landroid/widget/TabHost;->getTabWidget()Landroid/widget/TabWidget;

    move-result-object v2

    invoke-virtual {v2, v1, v1, v1, v1}, Landroid/widget/TabWidget;->setPadding(IIII)V

    .line 84
    new-instance v2, Landroid/content/Intent;

    invoke-direct {v2}, Landroid/content/Intent;-><init>()V

    const-class v3, Lcom/opongo/blogapp/activities/RecentPostsListActivity;

    invoke-virtual {v2, p0, v3}, Landroid/content/Intent;->setClass(Landroid/content/Context;Ljava/lang/Class;)Landroid/content/Intent;

    move-result-object v2

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->tab1:Landroid/content/Intent;

    .line 86
    new-instance v2, Landroid/widget/TextView;

    invoke-direct {v2, p0}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    const v3, 0x7f07000f

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 87
    iget-object v4, p0, Lcom/opongo/blogapp/activities/PostsActivity;->tab1:Landroid/content/Intent;

    .line 86
    invoke-direct {p0, v2, v3, v4}, Lcom/opongo/blogapp/activities/PostsActivity;->setupTab(Landroid/view/View;Ljava/lang/String;Landroid/content/Intent;)V

    .line 88
    new-instance v2, Landroid/widget/TextView;

    invoke-direct {v2, p0}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    const v3, 0x7f070010

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 89
    new-instance v4, Landroid/content/Intent;

    invoke-direct {v4}, Landroid/content/Intent;-><init>()V

    const-class v5, Lcom/opongo/blogapp/activities/MostReadPostsListActivity;

    invoke-virtual {v4, p0, v5}, Landroid/content/Intent;->setClass(Landroid/content/Context;Ljava/lang/Class;)Landroid/content/Intent;

    move-result-object v4

    .line 88
    invoke-direct {p0, v2, v3, v4}, Lcom/opongo/blogapp/activities/PostsActivity;->setupTab(Landroid/view/View;Ljava/lang/String;Landroid/content/Intent;)V

    .line 90
    new-instance v2, Landroid/widget/TextView;

    invoke-direct {v2, p0}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    const v3, 0x7f070011

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 91
    new-instance v4, Landroid/content/Intent;

    invoke-direct {v4}, Landroid/content/Intent;-><init>()V

    .line 92
    const-class v5, Lcom/opongo/blogapp/activities/MostCommentedPostsListActivity;

    .line 91
    invoke-virtual {v4, p0, v5}, Landroid/content/Intent;->setClass(Landroid/content/Context;Ljava/lang/Class;)Landroid/content/Intent;

    move-result-object v4

    .line 90
    invoke-direct {p0, v2, v3, v4}, Lcom/opongo/blogapp/activities/PostsActivity;->setupTab(Landroid/view/View;Ljava/lang/String;Landroid/content/Intent;)V

    .line 94
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->getIntent()Landroid/content/Intent;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 97
    .local v0, extras:Landroid/os/Bundle;
    if-eqz v0, :cond_2

    .line 99
    const-string v2, "POST_ID"

    invoke-virtual {v0, v2}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->post_id:I

    .line 100
    iget v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->post_id:I

    invoke-direct {p0, v2}, Lcom/opongo/blogapp/activities/PostsActivity;->openPostByBroadcast(I)V

    .line 103
    :cond_2
    new-instance v2, Lcom/opongo/blogapp/activities/PostsActivity$1;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/PostsActivity$1;-><init>(Lcom/opongo/blogapp/activities/PostsActivity;)V

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver:Landroid/content/BroadcastReceiver;

    .line 116
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver:Landroid/content/BroadcastReceiver;

    new-instance v3, Landroid/content/IntentFilter;

    .line 117
    const-string v4, "com.opongo.progressDialog_show"

    invoke-direct {v3, v4}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 116
    invoke-virtual {p0, v2, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 119
    new-instance v2, Lcom/opongo/blogapp/activities/PostsActivity$2;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/PostsActivity$2;-><init>(Lcom/opongo/blogapp/activities/PostsActivity;)V

    iput-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver2:Landroid/content/BroadcastReceiver;

    .line 127
    iget-object v2, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver2:Landroid/content/BroadcastReceiver;

    new-instance v3, Landroid/content/IntentFilter;

    .line 128
    const-string v4, "com.opongo.progressDialog_hide"

    invoke-direct {v3, v4}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 127
    invoke-virtual {p0, v2, v3}, Lcom/opongo/blogapp/activities/PostsActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 130
    return-void
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 231
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const v1, 0x7f0e0005

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 232
    invoke-super {p0, p1}, Landroid/app/TabActivity;->onCreateOptionsMenu(Landroid/view/Menu;)Z

    move-result v0

    return v0
.end method

.method protected onDestroy()V
    .locals 1

    .prologue
    .line 246
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    invoke-virtual {v0}, Landroid/app/ProgressDialog;->dismiss()V

    .line 247
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->progressDialog:Landroid/app/ProgressDialog;

    .line 248
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostsActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 249
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostsActivity;->receiver2:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostsActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 250
    invoke-super {p0}, Landroid/app/TabActivity;->onDestroy()V

    .line 251
    return-void
.end method

.method public onNewIntent(Landroid/content/Intent;)V
    .locals 2
    .parameter "intent"

    .prologue
    .line 148
    invoke-virtual {p1}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 150
    .local v0, extras:Landroid/os/Bundle;
    if-eqz v0, :cond_0

    .line 152
    const-string v1, "POST_ID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 153
    const-string v1, "POST_ID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/opongo/blogapp/activities/PostsActivity;->post_id:I

    .line 154
    iget v1, p0, Lcom/opongo/blogapp/activities/PostsActivity;->post_id:I

    invoke-direct {p0, v1}, Lcom/opongo/blogapp/activities/PostsActivity;->openPostByBroadcast(I)V

    .line 158
    :cond_0
    invoke-super {p0, p1}, Landroid/app/TabActivity;->onNewIntent(Landroid/content/Intent;)V

    .line 159
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 2
    .parameter "item"

    .prologue
    .line 236
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v0

    const v1, 0x7f080068

    if-ne v0, v1, :cond_0

    .line 237
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostsActivity;->onSearchRequested()Z

    .line 238
    const/4 v0, 0x1

    .line 240
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public onSearchRequested()Z
    .locals 2

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 178
    invoke-virtual {p0, v1, v0, v1, v0}, Lcom/opongo/blogapp/activities/PostsActivity;->startSearch(Ljava/lang/String;ZLandroid/os/Bundle;Z)V

    .line 179
    const/4 v0, 0x1

    return v0
.end method

.method public onStart()V
    .locals 9

    .prologue
    .line 193
    sget-boolean v5, Lcom/opongo/blogapp/activities/PostsActivity;->DEBUG:Z

    if-eqz v5, :cond_0

    .line 194
    sget-object v5, Lcom/opongo/blogapp/activities/PostsActivity;->TAG:Ljava/lang/String;

    const-string v6, "StartMain"

    invoke-static {v5, v6}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 196
    :cond_0
    iget-object v5, p0, Lcom/opongo/blogapp/activities/PostsActivity;->settings:Landroid/content/SharedPreferences;

    const-string v6, "last_registerUser"

    const-wide/16 v7, 0x0

    invoke-interface {v5, v6, v7, v8}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v1

    .line 197
    .local v1, last_registerUser:J
    new-instance v5, Ljava/util/Date;

    invoke-direct {v5}, Ljava/util/Date;-><init>()V

    invoke-virtual {v5}, Ljava/util/Date;->getTime()J

    move-result-wide v3

    .line 199
    .local v3, now:J
    const-wide/32 v5, 0x2932e00

    sub-long v5, v3, v5

    cmp-long v5, v1, v5

    if-gez v5, :cond_1

    .line 200
    iget-object v5, p0, Lcom/opongo/blogapp/activities/PostsActivity;->editor:Landroid/content/SharedPreferences$Editor;

    const-string v6, "last_registerUser"

    invoke-interface {v5, v6, v3, v4}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    .line 201
    iget-object v5, p0, Lcom/opongo/blogapp/activities/PostsActivity;->editor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v5}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 203
    new-instance v0, Lcom/opongo/blogapp/manager/APIManager;

    invoke-direct {v0, p0}, Lcom/opongo/blogapp/manager/APIManager;-><init>(Landroid/content/Context;)V

    .line 209
    .local v0, apiManager:Lcom/opongo/blogapp/manager/APIManager;
    new-instance v5, Ljava/lang/Thread;

    new-instance v6, Lcom/opongo/blogapp/activities/PostsActivity$3;

    invoke-direct {v6, p0, v0}, Lcom/opongo/blogapp/activities/PostsActivity$3;-><init>(Lcom/opongo/blogapp/activities/PostsActivity;Lcom/opongo/blogapp/manager/APIManager;)V

    invoke-direct {v5, v6}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    .line 223
    invoke-virtual {v5}, Ljava/lang/Thread;->start()V

    .line 226
    .end local v0           #apiManager:Lcom/opongo/blogapp/manager/APIManager;
    :cond_1
    invoke-super {p0}, Landroid/app/TabActivity;->onStart()V

    .line 227
    return-void
.end method
